﻿using System;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using TwitterClient2.Model;
using TwitterClient2.ImageProcessing;
using TwitterClient2.Controller;
using TwitterClient2.Components;


namespace TwitterClient2
{
    public partial class Twitter : Form
    {

        private TwitterClientController controller = TwitterClientController.getInstance();
        protected Bitmap backBuffer;
        protected Image constantAlphaImage;
        public Panel PanelLoginInstance { get { return this.panelLogin; } }
        public Panel PanelStartBackgroundInstance { get { return this.panelStartBackground1; } }
        public Panel PanelMainMenueInstance { get { return this.mainMenu; } }
        public PanelHome PanelHomeInstance { get { return this.panelHome; } }
        public PanelSearch PanelSearchInstance { get { return this.panelSearch; } }
        public PanelUser PanelUserInstance { get { return this.panelUser; } }
        public PanelFollowers PanelFollowersInstance { get { return this.panelFollowers; } }
        public PanelFriends PanelFriendsInstance { get { return this.panelFriends; } }
        public PanelMessages PanelMessagesInstance { get { return this.panelMessages; } }
        public PanelMessageDetail PanelMessageDetailInstance { get { return this.panelMessageDetail; } }
        public PanelNews PanelNewsInstance { get { return this.panelNews; } }
        public MainMenu MainMenuBottonInstance { get { return this.menuBottom; } }
        public MenuItem MenuItemUpdateInstance { get { return this.menuItemUpdate; } }
        public MenuItem MenuItemChangeUserInstance { get { return this.menuItemChangeUser; } }
        public Twitter()
        {

            this.controller.viewmanager = this;
            InitializeComponent();

            backBuffer = new Bitmap(200, 59, System.Drawing.Imaging.PixelFormat.Format32bppRgb);




            String sRes = "TwitterClient2.Images.twitterLogo.png";
            Assembly aAsm = this.GetType().Assembly;
            Stream aStream = aAsm.GetManifestResourceStream(sRes);
            constantAlphaImage = new Bitmap(aStream);

        }



        private void imageButton1_Click(object sender, EventArgs e)
        {

        }

        private void menuItemUpdateClick(object sender, EventArgs e)
        {

            this.Enabled = false;
            Cursor.Current = Cursors.WaitCursor;
            this.controller.performUserInput(TwitterClientController.UPDATE_DATA, null);
            Cursor.Current = Cursors.Default;
            this.Enabled = true;
        }

        private void menuItemChangeUserClick(object sender, EventArgs e)
        {
            this.controller.performUserInput(TwitterClientController.CHANGE_USER, null);
        }

        private void panelLogin_GotFocus(object sender, EventArgs e)
        {

        }

        private void Twitter_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == System.Windows.Forms.Keys.Up))
            {
                // Up
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Down))
            {
                // Down
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Left))
            {
                // Left
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Right))
            {
                // Right
            }
            if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
            {
                // Enter
            }

        }


    }
}